package com.wmapp.utils;

import java.util.Iterator;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public abstract class SimpleStringUtils {
	private static Log log=LogFactory.getLog(SimpleStringUtils.class);
	
	public static String join(String... strs){
		StringBuffer buffer=new StringBuffer();
		
		if(strs!=null){
			for (int i = 0; i < strs.length; i++) {
				buffer.append(strs[i]);
			}
		}
		
		return buffer.toString();
	}
	
	public static String list2String(List<String> list){
		StringBuffer buffer=new StringBuffer();
		
		for (Iterator iterator = list.iterator(); iterator.hasNext();) {
			String str = (String) iterator.next();
			
			buffer.append(str);
			if(iterator.hasNext()){
				buffer.append(",");
			}
		}
		
		return buffer.toString();
	}
	
	public static String array2String(Object[] arr){
		StringBuffer ret=new StringBuffer();
		
		for (int i = 0; i < arr.length; i++) {
			ret.append(arr[i]);
			
			if(i!=(arr.length-1)){
				ret.append(",");
			}
		}
		
		return ret.toString();
	}
}
